#include <iostream>
using namespace std;
class SimplePoint{
private:
    int x,y;
public:    
    SimplePoint(int x=0,int y=0):
    x(x)
    ,y(y)
    {
    }
    //assignment operator
    SimplePoint& operator=(const SimplePoint& rhs){
        cout<<"use assignmint operator"<<endl;
        if(this!=&rhs){
            x=rhs.x;
            y=rhs.y;
        }
        return *this;
    }
    void print(void){
        cout<<"x="<<x<<","<<"y="<<y<<endl;
    }

};
    
int main(int argc, char * argv[]){
    SimplePoint p1(1,2);
    SimplePoint p2(2,3);
    SimplePoint p3(3,4);

    cout<<"p1";p1.print();
    cout<<"p2";p2.print();
    cout<<"p3";p3.print();
    

    p2=p1;
    cout<<"after assignment"<<endl;
    cout<<"p1";p1.print();
    cout<<"p2";p2.print();

    p3=p2=p1;
    cout<<"after list assignment"<<endl;
    cout<<"p1";p1.print();
    cout<<"p2";p2.print();
    cout<<"p3";p3.print();
    return 0;
}

